<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
 <include file="Public/breadcrumb"/>
 <style>#search-form > .form-group{margin-left: 10px;}</style>
  <!-- Main content -->
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><i class="fa fa-list"></i> 相册列表</h3>
        </div>
        <div class="panel-body">
          <div class="navbar navbar-default">
              <form action="{:U('Admin/goods/export_goods')}" id="search-form2" class="navbar-form form-inline" method="post" >




                  <!--<div class="form-group">-->
                      <!--<select name="goods_type" id="goods_type" class="form-control">-->
                          <!--<option value="">选择店铺类别</option>-->
                          <!--<option value="3">天猫</option>-->
                          <!--<option value="4">淘宝</option>-->
                          <!--<option value="5">京东</option>-->
                          <!--<option value="6">其他</option>-->
                      <!--</select>-->
                  <!--</div>-->
                  <!--<div class="form-group">-->
                      <!--<select name="status" id="is_on_sale" class="form-control">-->
                          <!--<option value="">选择状态</option>-->
                          <!--<option value="1">上架</option>-->
                          <!--<option value="0">下架</option>-->
                          <!--<option value="3">完成</option>-->
                      <!--</select>-->
                  <!--</div>-->
                  <!--<div class="form-group">-->
                      <!--<label class="control-label" for="input-date-added">添加日期</label>-->
                      <!--<div class="input-group">-->
                          <!--<input type="text" name="timegap" value="{$timegap}" placeholder="添加日期"  id="add_time" class="input-sm">-->
                      <!--</div>-->
                  <!--</div>-->
                  <!--<div class="form-group">-->
                      <!--<label class="control-label" for="input-order-id">关键词</label>-->
                      <!--<div class="input-group">-->
                        <!--<input type="text" name="key_word" value="" style="width:250px;" placeholder="输入店铺名或店铺编号搜索" id="input-order-id" class="form-control">-->
                      <!--</div>-->
                  <!--</div>-->
                <!--  <div class="form-group">
                      <label class="control-label" for="input-order-id">店铺编号</label>
                      <div class="input-group">
                          <input type="text" name="goods_number" value="" placeholder="输入店铺编号搜索" id="goods_number" class="form-control">
                      </div>
                  </div>-->
                  <!--排序规则-->
                <!--<input type="hidden" name="orderby1" value="goods_id" />-->
                <!--<input type="hidden" name="orderby2" value="desc" />-->
                <!--<button type="button"  target="_blank" onclick="ajax_get_table('search-form2',1)" id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选</button>-->
                <!--<button type="submit"    class="btn btn-default "><i class="fa fa-file-excel-o"></i> 导出excel</button>-->
                <button type="button" onclick="location.href='{:U('Admin/Company/addEditImages')}'" class="btn btn-primary pull-right"><i class="fa fa-plus"></i>添加</button>
              </form>
          </div>

          <div  >
              <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                  <div class="table-responsive">
                      <table class="table table-bordered table-hover">
                          <thead>
                          <tr>
                              <td style="width: 1px;" class="text-center">
                                  <!--
                                      <input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);">
                                  -->
                              </td>
                              <td class="text-right">
                                  <a href="javascript:sort('id');">ID</a>
                              </td>
                              <td class="text-left">名称</td>
                              <td class="text-center">状态</td>
                              <td class="text-left">添加时间</td>
                              <td class="text-right">操作</td>
                          </tr>
                          </thead>
                          <tbody>
                          <volist name="lists" id="list">
                              <tr>
                                  <td class="text-center">
                                      <!-- <input type="checkbox" name="selected[]" value="6">-->
                                      <input type="hidden" name="shipping_code[]" value="flat.flat">
                                  </td>
                                  <td class="text-right">{$list.id}</td>
                                  <td class="text-left">{$list.name}</td>



                                  <td class="text-center">

                                          <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[status] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('company_album','id','{$list.id}','status',this)"/>

                                  </td>

                                  <td>
                                      {$list[add_time]|date='Y-m-d H:i:s',###}
                                  </td>

                                  <td class="text-right">
                                      <!--<a  target="_blank" href="{:U('Home/Goods/goodsInfo',array('id'=>$list['goods_id']))}" class="btn btn-info" title="查看详情"><i class="fa fa-eye"></i></a>-->
                                      <a href="{:U('Admin/Company/addEditImages',array('id'=>$list['id']))}" class="btn btn-primary" title="编辑"><i class="fa fa-pencil"></i></a>
                                      <a href="javascript:void(0);" onclick="del('{$list[id]}')" class="btn btn-danger" title="删除"><i class="fa fa-trash-o"></i></a>
                                      <!--<a href="javascript:void(0);" onclick="ClearGoodsHtml('{$list[goods_id]}')" class="btn btn-default" title="清除静态缓存页面"><i class="fa fa-fw fa-refresh"></i></a>-->
                                      <!--<a href="javascript:void(0);" onclick="ClearGoodsThumb('{$list[goods_id]}')" class="btn btn-default" title="清除缩略图缓存"><i class="glyphicon glyphicon-picture"></i></a>-->
                                  </td>
                              </tr>
                          </volist>
                          </tbody>
                      </table>
                  </div>
              </form>
              <div class="row">
                  <div class="col-sm-3 text-left"></div>
                  <div class="col-sm-9 text-right">{$page}</div>
              </div>
          </div>
        </div>
      </div>
    </div>
    <!-- /.row --> 
  </section>
  <!-- /.content --> 
</div>
<!-- /.content-wrapper --> 
<script>
    $(document).ready(function(){
		// ajax 加载商品列表
        ajax_get_table('search-form2',1);
        $('#add_time').daterangepicker({
            format:"YYYY/MM/DD",
            singleDatePicker: false,
            showDropdowns: true,
            minDate:'2016/01/01',
            maxDate:'2030/01/01',
            startDate:'2016/01/01',
            locale : {
                applyLabel : '确定',
                cancelLabel : '取消',
                fromLabel : '起始时间',
                toLabel : '结束时间',
                customRangeLabel : '自定义',
                daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
                monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
                firstDay : 1
            }
        });

    });


    // ajax 抓取页面 form 为表单id  page 为当前第几页
    function ajax_get_table(form,page){
		cur_page = page; //当前页面 保存为全局变量
            $.ajax({
                type : "POST",
                url:"/index.php?m=Admin&c=goods&a=ajaxGoodsList&p="+page,//+tab,
                data : $('#'+form).serialize(),// 你的formid
                success: function(data){
                    $("#ajax_return").html('');
                    $("#ajax_return").append(data);
                }
            });
        }
      
        // 点击排序
        function sort(field)
        {
           $("input[name='orderby1']").val(field);
           var v = $("input[name='orderby2']").val() == 'desc' ? 'asc' : 'desc';             
           $("input[name='orderby2']").val(v);
           ajax_get_table('search-form2',cur_page);
        }
        
        // 删除操作
        function del(id)
        {
            if(!confirm('确定要删除吗?'))
                return false;

            window.location.href="/index.php?m=Admin&c=Company&a=delAlbum&id="+id;
//		$.ajax({
//
//			success: function(v){
//
//
//
//                var v =  eval('('+v+')');
//                alert(v.msg);return false;
//                if(v.hasOwnProperty('status') && (v.status == 1))
//                        ajax_get_table('search-form2',cur_page);
//                else
//                        layer.msg(v.msg, {icon: 2,time: 1000}); //alert(v.msg);
//			}
//		});
               return false;
          }
</script> 
</body>
</html>